/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pku.lbs.web.listener;

import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import pku.lbs.core.Constants;

/**
 *
 * @author yongchao
 */
public class StartupListener implements ServletContextListener {

    private static final Log log = LogFactory.getLog(StartupListener.class);

    public void contextInitialized(ServletContextEvent event) {
        try {
            // init everything in backend
            Constants.init("config.properties");
        } catch (ConfigurationException ex) {
            Logger.getLogger(StartupListener.class.getName()).log(Level.SEVERE, null, ex);
        }
        log.debug("Initializing context...");
    }

    public void contextDestroyed(ServletContextEvent event) {
        log.debug("Destroy context...");
    }
}
